home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / pluginy Firefox / 4364 / 4364.xpi / chrome / elemhidehelper.jar / content / attribute.xml < prev    next >
Extensible Markup Language  |  2009-07-01  |  3KB  |  75 lines

  1. <?xml version="1.0"?>
  2.  
  3. <!-- ***** BEGIN LICENSE BLOCK *****
  4.      - Version: MPL 1.1
  5.      -
  6.      - The contents of this file are subject to the Mozilla Public License Version
  7.      - 1.1 (the "License"); you may not use this file except in compliance with
  8.      - the License. You may obtain a copy of the License at
  9.      - http://www.mozilla.org/MPL/
  10.      -
  11.      - Software distributed under the License is distributed on an "AS IS" basis,
  12.      - WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  13.      - for the specific language governing rights and limitations under the
  14.      - License.
  15.      -
  16.      - The Original Code is Adblock Plus Element Hiding Helper.
  17.      -
  18.      - The Initial Developer of the Original Code is
  19.      - Wladimir Palant.
  20.      - Portions created by the Initial Developer are Copyright (C) 2006-2009
  21.      - the Initial Developer. All Rights Reserved.
  22.      -
  23.      - Contributor(s):
  24.      -
  25.      - ***** END LICENSE BLOCK ***** -->
  26.  
  27. <bindings id="attributeBindings"
  28.      xmlns="http://www.mozilla.org/xbl"
  29.      xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
  30.      xmlns:xbl="http://www.mozilla.org/xbl">
  31.  
  32.     <binding id="attributeBasic">
  33.         <content>
  34.             <xul:checkbox anonid="checkbox" xbl:inherits="checked,label"/>
  35.         </content>
  36.         <implementation>
  37.             <property name="checked">
  38.                 <getter>
  39.                     return document.getAnonymousElementByAttribute(this, "anonid", "checkbox").checked;
  40.                 </getter>
  41.             </property>
  42.         </implementation>
  43.         <handlers>
  44.             <handler event="command" phase="bubble" action="toggleAttr(event.currentTarget);"/>
  45.             <handler event="focus" phase="bubble" action="event.currentTarget.setAttribute('selected', 'true');"/>
  46.             <handler event="blur" phase="bubble" action="event.currentTarget.removeAttribute('selected');"/>
  47.         </handlers>
  48.     </binding>
  49.  
  50.     <binding id="attributeAdvanced" extends="chrome://elemhidehelper/content/attribute.xml#attributeBasic">
  51.         <content>
  52.             <xul:checkbox anonid="checkbox" xbl:inherits="checked"/>
  53.             <xul:vbox flex="1">
  54.                 <xul:label anonid="label" xbl:inherits="value=label" onclick="document.getAnonymousElementByAttribute(this.parentNode.parentNode, 'anonid', 'checkbox').click();"/>
  55.                 <xul:textbox anonid="textbox" xbl:inherits="value"/>
  56.             </xul:vbox>
  57.         </content>
  58.         <implementation>
  59.             <constructor>
  60.                 var randID = new String(Math.random()).replace(/\D/g, "");
  61.                 document.getAnonymousElementByAttribute(this, "anonid", "checkbox").setAttribute("id", randID);
  62.                 document.getAnonymousElementByAttribute(this, "anonid", "label").setAttribute("control", randID);
  63.             </constructor>
  64.             <property name="value">
  65.                 <getter>
  66.                     return document.getAnonymousElementByAttribute(this, "anonid", "textbox").value;
  67.                 </getter>
  68.             </property>
  69.         </implementation>
  70.         <handlers>
  71.             <handler event="input" phase="bubble" action="setSelectedAttrValue(event.currentTarget);"/>
  72.         </handlers>
  73.     </binding>
  74. </bindings>
  75.